<template>
  <div class="allCivil">
    <div class="header">
      <div class="titleContainer">
        <img :src="customerLogo" @click="handleLogoClick" />
        <span class="title" @click="handleLogoClick"> {{ customerDesc }} </span>
      </div>
      <div class="mine" @click.stop="handleMine" v-if="from!='ylIndex'">
        <span>我的</span>
        <img class="avator" src="https://img3.job1001.com/data_center/mine/avator.png" alt="" />
      </div>
    </div>
    <div class="contentContainer" v-loading="loading">
      <div class="main">
        <div class="topNav">
          <div class="topNavItem">
            <div class="backBtn" title="返回" @click="handleBackBtnClick">
              <img :src="backBtn" alt="" />
            </div>
            <div class="navPositionName" v-if="teacherPositionInfo.noticeTitle">
              {{
                `${teacherPositionInfo.noticeTitle}`
              }}
            </div>
          </div>
        </div>
        <div class="mainContent">
          <el-scrollbar style="height: 100%">
            <div class="content">
              <div class="uniInfo">
                <div class="title-box">
                  <div class="icon-box">
                    <img :src="hat" alt="" class="icon" />
                  </div>
                  <div class="uniTitle">招聘公告</div>
                </div>
                <div class="uniContentContainer">
                  <div class="contentTopTitle">
                    {{teacherPositionInfo.noticeTitle}}
                  </div>
                  <!-- <div class="contentTopBox" v-if="teacherPositionInfo.signupTime">
                    <div class="signupTime">报名时间：{{teacherPositionInfo.signupTime}} <span
                        v-if="teacherPositionInfo.deadlineTime">至
                        {{teacherPositionInfo.deadlineTime}}</span>
                    </div>
                  </div> -->
                  <div class="contentRichBox">
                    <div v-html="teacherPositionInfo.noticeContent"></div>
                  </div>
                  <div class="tips">
                    免责声明：提示广大考生，请报考前仔细阅读对应职位招录要求或联系招录单位确认，本职位检索系统提供内容仅供参考。
                  </div>
                </div>
              </div>
            </div>
          </el-scrollbar>
        </div>
      </div>
    </div>
    <freeDialog />
  </div>
</template>

<script>
import freeDialog from "@/components/freeDialog";
import { getCivilTeacherInfo } from "@/api/civil-job";
import backBtn from "@/icons/backBtn.png";
import ztLogo from "@/assets/home/zt-logo.png";
import governmentIcon from "@/assets/home/governmentIcon.png";

export default {
  name: "civilTeacherDetail",
  components: {freeDialog},
  data() {
    return {
      from:'',
      customerDesc: "",
      hat: "https://img3.job1001.com/data_center/images/hat.png",
      governmentIcon,
      SecretKey: "",
      customerLogo: "",
      pageTitle: "",
      backBtn,
      ztLogo,
      wxImg: "",
      showGlass: false,
      loading: false,
      id: "",
      year: "",
      teacherPositionInfo: {},
    };
  },
  async created() {
    //特殊情况(from=ylIndex)下不展示mineAvatar组件
    this.from = sessionStorage.getItem("from")||this.$route.query.from;
    this.SecretKey = this.$route.query.SecretKey;
    this.id = this.$route.query.id;
    this.year = this.$route.query.year;
    if (localStorage.getItem("customerDesc")) {
      this.customerDesc = localStorage.getItem("customerDesc");
      document.title = this.customerDesc;
    }

    const extraJson = localStorage.getItem("extra");
    if (extraJson) {
      const extra = JSON.parse(extraJson);
      this.customerLogo = extra.icon ? extra.icon : this.governmentIcon;
    } else {
      this.customerLogo = this.governmentIcon;
    }

    const superToken = localStorage.getItem("superToken");
    if (superToken) {
      this.pageTitle = localStorage.getItem("customerDesc");
    } else {
      this.pageTitle = "职神籍";
    }

    await this.getCivilTeacherInfoFn();
  },
  methods: {
    async getCivilTeacherInfoFn() {
      this.loading = true;
      const res = await getCivilTeacherInfo({ id: this.id });
      this.loading = false;
      if (res.code == 200) {
        this.teacherPositionInfo = res.data;
        
      }
    },
    handleWebsiteClick(value) {
      let url = value;
      if (!value.includes("//")) {
        url = "//" + value;
      }
      window.open(url, "_blank");
    },
    handleBackBtnClick() {
      
      if (this.from == "ylIndex") {
        this.$router.push({
          path: "/freehome",
          query: {
            from: "ylIndex",
          },
        });
        return;
      }
      this.$store.dispatch("settings/changeSetting", {
        key: "showType",
        value: "civil",
      });
      this.$router.push({
        path: "/position",
        query: {
          superToken: this.$route.query.superToken || "",
          SecretKey: this.$route.query.SecretKey || "",
        },
      });
    },
    handleLogoClick() {
      
      if (this.from == "ylIndex") {
        this.$router.push({
          path: "/freehome",
          query: {
            from: "ylIndex",
          },
        });
        return;
      }
      this.$store.dispatch("settings/changeSetting", {
        key: "showType",
        value: "position",
      });
      this.$router.push({
        path: "/position",
        query: {
          superToken: this.$route.query.superToken || "",
          SecretKey: this.$route.query.SecretKey || "",
          customerName: this.$route.query.customerName || "",
        },
      });
    },
    handleMine() {
      this.$router.push({
        path: "/mine",
        query: {
          id: this.$route.query.id,
          superToken: this.$route.query.superToken || "",
          SecretKey: this.$route.query.SecretKey || "",
          customerName: this.$route.query.customerName,
        },
      });
    },
  },
};
</script>
<style scoped lang="scss">
::v-deep .el-scrollbar__wrap {
  overflow-x: hidden;
}
.allCivil {
  position: relative;
  background: #f7f8fa;
  height: 100%;
  min-width: 1190px;
  .glass {
    width: 100%;
    height: 100%;
    background: rgba(22, 22, 22, 0.6);
    backdrop-filter: blur(3px);
    position: absolute;
    top: 0;
    z-index: 9999;
    display: flex;
    flex-direction: row;
    justify-content: center;
    padding-top: 20%;
    .wx-card {
      width: 361px;
      height: 316px;
      background-image: url("../../assets/home/wx-bg.png");
      background-size: 100% 100%;
      padding: 23px;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      .title {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        margin-bottom: 20px;
        img {
          width: 28px;
          height: 28px;
        }
        span {
          font-weight: 800;
          font-size: 16px;
          color: #141416;
        }
      }
      .desc {
        margin-bottom: 19px;
      }
      .wx {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        margin-bottom: 15px;
        background-color: #ffffff;
        padding: 3px 3px 4px 4px;
        border-radius: 4px;
        img {
          width: 148px;
          height: 148px;
        }
      }
      .name {
        font-family: PingFang-SC, PingFang-SC;
        font-weight: bold;
        font-size: 15px;
        color: #333333;
      }
    }
  }
  .header {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 57px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(7px);
    background-size: 100% 57px;
    z-index: 2;
    .titleContainer {
      display: flex;
      align-items: center;
      padding-left: 25px;
      color: #fff;
      font-size: 17px;
      line-height: 24px;
      letter-spacing: 2px;
      .title {
        font-family: "title-home-font";
        cursor: pointer;
        max-width: 26vw;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-inline-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 1;
      }
      img {
        height: 24px;
        width: auto;
        cursor: pointer;
        margin-right: 5px;
      }
    }
    .mine {
      color: #fff;
      cursor: pointer;
      display: flex;
      align-items: center;
      font-size: 14px;
      .avator {
        height: 24px;
        width: 24px;
        margin: 0 24px 0 8px;
        border-radius: 50%;
        overflow: hidden;
      }
    }
  }
  .contentContainer {
    width: 100%;
    height: 100%;
    padding-top: 52px;
    display: flex;
    background: url("../../assets/home/back.png") no-repeat;
    flex-direction: column;
    background-size: 100.1% auto;
    align-items: center;
    min-width: 1375px;
    .experienceTime {
      height: 28px;
      z-index: 3;
      position: absolute;
      top: 16px;
      right: 110px;
      display: flex;
      flex-direction: row;
      align-items: center;
      color: #ffffff;
      .time {
        margin-left: 9px;
        display: flex;
        flex-direction: row;
        align-items: center;
        .time-box {
          width: 56px;
          height: 28px;
          padding: 4px 8px; /* 内边距 */
          border: 1px solid #5e6d84; /* 边框 */
          border-radius: 4px; /* 圆角 */
          box-shadow: 0 0 5px rgba(0, 0, 0, 0.3); /* 阴影 */
          margin: 0 4px;
          font-family: ddin;
          font-weight: bold;
          font-size: 15px;
          color: #ffffff;
        }
        .dot {
          height: 18px;
          display: flex;
          flex-direction: column;
          justify-content: space-evenly;
          div {
            width: 4px;
            height: 4px;
            background: #ffffff;
            border-radius: 50%;
          }
        }
      }
    }
    .main {
      height: calc(100% - 25px);
      position: relative;
      border-radius: 20px;
      margin-top: 24px;
      background-color: white;
      width: calc(100vw - 34px);
      min-width: 1375px;
      display: flex;
      flex-direction: column;
      .topNav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 60px;
        padding: 0 16px;
        .topNavItem {
          display: flex;
          width: 100%;
        }
        .topNavItemRight {
          display: flex;
          align-items: center;
          padding-right: 65px;
        }
        .backBtn {
          width: 36px;
          height: 36px;
          margin-right: 16px;
          cursor: pointer;
          img {
            width: 36px;
            height: 36px;
          }
        }
        .navPositionName {
          font-size: 18px;
          font-family: PingFangSC-Medium, PingFang SC;
          font-weight: 600;
          color: #222222;
          line-height: 28px;
          padding: 3px 16px 0 24px;
          margin: 0 -16px 0 -23px;
          width: 100%;
          border-bottom: 1px solid #cfd8f5;
        }
      }
      .mainContent {
        width: 100%;
        height: calc(100% - 60px);
        box-shadow: 0px 24px 32px -22px #d7e3f8 inset;
        .content {
          padding: 17px 0 0 24px;
        }
        .headerInfo {
          font-family: PingFangSC, PingFang SC;
          font-weight: 400;
          font-size: 14px;
          color: #666666;
          margin-bottom: 18px;
          > span {
            margin-right: 6px;
          }
        }
        .dataOverview {
          display: grid;
          grid-template-columns: repeat(5, 1fr);
          gap: 10px;
          margin: 20px 24px 10px 0;
          .item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 18px;
            border-radius: 8px;
            border: 1px solid #eaedf7;
            .beforeIcon {
              border-radius: 8px;
              margin-right: 12px;
              .beforeIconClass {
                width: 44px;
                height: 44px;
              }
            }
            .dataItemContent {
              display: flex;
              flex-direction: column;
              .dataItemName {
                font-family: PingFangSC, PingFang SC;
                font-weight: 400;
                font-size: 14px;
                color: #a2a5b3;
                margin-bottom: 5px;
              }
              .dataItemValue {
                font-family: ddin-extraBold;
                font-weight: bold;
                font-size: 24px;
                color: #242f57;
              }
            }
            .afterIconClass {
              width: 44px;
              height: 44px;
              margin-left: auto;
            }
          }
          .locationBox {
            display: block;
            border-radius: 8px;
            background: #f4faff;
            font-family: PingFang-SC, PingFang-SC;
            font-weight: bold;
            font-size: 16px;
            .year {
              margin-bottom: 12px;
            }
          }
        }
        .uniInfo {
          margin-bottom: 18px;
          margin-right: 24px;
          &:last-child {
            margin-bottom: 0;
          }
          .title-box {
            display: flex;
            align-items: center;
            .icon-box {
              display: flex;
              z-index: 2;
              border-right: 6px solid #fff;
              border-radius: 50%;
              .icon {
                width: 32px;
                height: 32px;
              }
            }
            .uniTitle {
              flex: 1;
              font-family: PingFang-SC, PingFang-SC;
              font-weight: bold;
              font-size: 16px;
              color: #222222;
              background: #f3f9fe;
              padding: 8px 0 8px 32px;
              margin-left: -24px;
              z-index: 1;
            }
          }
          .uniContentContainer {
            width: 1200px;
            margin: 0 auto;
            .contentTopTitle {
              font-family: PingFang-SC, PingFang-SC;
              font-weight: bold;
              font-size: 20px;
              color: #000000;
              line-height: 24px;
              text-align: center;
              font-style: normal;
              margin: 46px 0px 48px;
            }
            .contentTopBox {
              width: 100%;
              // height: 104px;
              padding: 16px;
              background-image: url("https://img3.job1001.com/data_center/images/contentTopBoxBG.png");
              background-repeat: no-repeat;
              background-size: 100% 100%;
              .signupTime {
                font-family: PingFang-SC, PingFang-SC;
                font-weight: bold;
                font-size: 16px;
                color: #333333;
                line-height: 24px;
                text-align: left;
                font-style: normal;
              }
            }
            .contentRichBox {
              margin-top: 24px;
              width: 100%;
            }
            .tips {
              font-family: PingFangSC, PingFang SC;
              font-weight: 400;
              font-size: 13px;
              color: #666;
              padding: 0 0 24px 0;
              margin-top: 12px;
            }
          }
        }
      }
    }
  }
}
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.5s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>
